from PySide2.QtWidgets import QMainWindow, QTabWidget
from PySide2.QtCore import QSize  # type: ignore
from PySide2.QtGui import QIcon  # type: ignore
# from PySide2.QtWidgets import *  # type: ignore
from ui.ui_data_adapter import title_ico, get_tab_pg_list


class Main_Form(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("合同管理信息系统")
        self.resize(1300, 700)
        icon = QIcon()
        icon.addFile(title_ico, QSize(), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(QIcon(title_ico))
        self.tab_widget = QTabWidget(self)
        self.setCentralWidget(self.tab_widget)
        self.tab_pg_list = get_tab_pg_list()
        if self.tab_pg_list:
            for tab_pg_dic in self.tab_pg_list:
                wg = tab_pg_dic["pg"]
                wg_name = tab_pg_dic["pg_name"]
                self.tab_widget.addTab(wg, wg_name)
